<?php
/*********************************************************************************
 
 * *******************************************************************************/
function proper_case($module){
	return $module;
}
require_once('include/MVC/Controller/SugarController.php');
class ControllerFactory{

	function getController($module){
		$class = ucfirst($module).'Controller';
		
		if(file_exists('custom/modules/'.$module.'/controller.php')){		
			require_once('custom/modules/'.$module.'/controller.php');
			if(class_exists($class))$controller = new $class();
		}elseif(file_exists('modules/'.$module.'/controller.php')){		
			require_once('modules/'.$module.'/controller.php');
			if(class_exists($class))$controller = new $class();
		}else
			$controller = new SugarController();
		//setup the controller
		$controller->setup($module);
		return $controller;
	}
}
?>
